//
//  AEPointsAcquireNavView.m
//  AESOLAR_IOS
//
//  Created by Bin Tang on 2024/10/16.
//  Copyright © 2024 Mr.Wang. All rights reserved.
//

#import "AEPointsAcquireNavView.h"
#import "AE_Solar-Swift.h"

@interface AEPointsAcquireNavView ()
@property (nonatomic, strong) UIView *navView;
/// 返回
@property (nonatomic, strong) UIButton *btnBack;

@property (nonatomic, strong) UILabel *navTitleLabel;

@end

@implementation AEPointsAcquireNavView

- (void)initWithSubView {
    [super initWithSubView];
//    self.backgroundColor = [UIColor orangeColor];
    
    [self initWithNavView];
    
    [self initWithbtnBack];
    
    [self initWithNavTitleLabel];
}

- (void)initWithNavView {
    if (!_navView) {
        CGRect frame = CGRectMake(0, SYS_STATUSBAR_HEIGHT + IPHONEX_TOP_SPACE, self.width, NAVBAR_HEIGHT_NOTOPSPACE);
        _navView = [[UIView alloc] initWithFrame:frame];
//        _navView.backgroundColor = [UIColor orangeColor];
        [self addSubview:_navView];
    }
}

/// 返回
- (void)initWithbtnBack {
    if (!_btnBack) {
        UIImage *image = [UIImage imageNamed:@"ic_nav_back_white"];
        CGRect frame = CGRectMake(4, (self.navView.height - 30) * 0.5, 30, 30);
        _btnBack = [UIButton createWithButton:self.navView frame:frame font:FONTSIZE(16) target:self action:@selector(actionWithBack:) propertiesBlock:^(UIButton * _Nonnull button) {
            [button setImage:image forState:UIControlStateNormal];
        }];
    }
}

- (void)initWithNavTitleLabel {
    if (!_navTitleLabel) {
        NSString *title = [AEStringExten localizedValueWithKey:@"积分获取"];
        UIFont *font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
        CGRect frame = CGRectMake(80, (self.navView.height - 30) * 0.5, self.navView.width - 80 * 2, 30);
        _navTitleLabel = [UILabel createWithLabel:self.navView frame:frame font:font propertiesBlock:^(UILabel * _Nonnull label) {
            label.textColor = kWhiteColor;
            label.text = title;
            label.textAlignment = NSTextAlignmentCenter;
        }];
    }
}

/// 返回
/// - Parameter sender: sender description
- (void)actionWithBack:(id)sender {
    if (self.touchBackBlock) {
        self.touchBackBlock();
    }
}


@end
